﻿using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AconITF.Core.Models
{
	public class VariableItem : BindableBase
	{
		/// <summary>
		/// 序号
		/// </summary>
		public int Id { get; set; }

		/// <summary>
		/// 变量名
		/// </summary>
		public string Name { get; set; }

		/// <summary>
		/// 原始通道号
		/// </summary>
		public int OriginalChannelIndex { get; set; }

		/// <summary>
		/// 数据索引号
		/// </summary>
		public int DataIndexNumber { get; set; }

		/// <summary>
		/// 相关项目
		/// </summary>
		public string Project { get; set; }

		/// <summary>
		/// 转换关系
		/// </summary>
		public string ConverRelationship { get; set; }

		/// <summary>
		/// 数值与物理量换算公式
		/// </summary>
		public string Formula
		{
			get
			{
				if (!string.IsNullOrEmpty(ConverRelationship))
				{
					return ConverRelationship.Split('=')[1];
				}
				return ConverRelationship;
			}
			set { ConverRelationship = value; }
		}
		/// <summary>
		/// 板卡别名。
		/// </summary>
		public string CardName { get; set; }

		/// <summary>
		/// 当前值
		/// </summary>
		public double CurrentValue { get => GetValue<double>(); set => SetValue(value); }

		/// <summary>
		/// 是否选中
		/// </summary>
		public bool IsSelected { get => GetValue<bool>(); set => SetValue(value); }
	}
}
